package com.gupao.javavip.netty.push.client.processor.handler;

import com.gupao.javavip.netty.push.api.Response;
import com.gupao.javavip.netty.push.api.ResponseCode;
import lombok.extern.apachecommons.CommonsLog;

@CommonsLog
public class ReceiveMsgResponseClientHandler extends AbstractPushMsgResponseClientHandler {
    @Override
    protected String buildReadTips() {
        return "收到推送消息";
    }

    @Override
    protected boolean checkResponseCode(Response response) {
        return ResponseCode.SUCCESS.name().equals(response.getCode()) && response.getPushMsg() != null;
    }

    @Override
    protected void whenResponseCodeIsSuccess(Response response) {
        log.debug("接收推送消息成功！");
    }

    @Override
    protected void whenResponseCodeIsFailure(Response response) {
        log.debug("未接收到最新的推送消息，来自服务端的应答：" + response.getMsg());
    }
}
